
var StartPageLayer = cc.Layer.extend({
	sprite:null,
	btn_Start:null,
	btn_List:null,
	pic_Startback:null,
	ctor:function () {
		//////////////////////////////
		// 1. super init first
		this._super();
		/////////////////////////////
		// 2. add a menu item with "X" image, which is clicked to quit the program
		//    you may modify it.
		// ask the window size
		var size = cc.winSize;
		// add a "close" icon to exit the progress. it's an autorelease object
		var startScene=ccs.load(res.startscene_json).node;
		this.addChild(startScene);
		
		pic_Startback=ccui.helper.seekWidgetByName(startScene, "Image_1");
		pic_Startback.setScaleY(theScaleH);
		
		btn_Start=ccui.helper.seekWidgetByName(startScene, "Button_1");
		btn_List=ccui.helper.seekWidgetByName(startScene, "Button_2");
		btn_Start.addTouchEventListener(this.backClick);
		btn_List.addTouchEventListener(this.backClick2);
		g_Value_gameScore=0;
		g_Value_gameLevel=1;
		g_Array_DaoJu=[0,0,0,0,0];
		
		var userinfo=new UserInfo();
		userinfo.setPosition(384,size.height-1024+990);
		this.addChild(userinfo, 30);
		
		return true;
	},
	backClick2:function(sender,type){
		switch (type) {        
		case ccui.Widget.TOUCH_ENDED:
			cc.director.runScene(new RankPageScene());
			break;        
		default:  break;
		}
	},
	backClick:function(sender,type)
	{
		switch (type) {        
		//pageView当前所在的page的index发生了变化。
		case ccui.Widget.TOUCH_ENDED:
//			helloworldl.resetItems(0);
			cc.director.runScene(new GameCenterScene());
			break;        
		default:  break;
		}
	}
});

var StartPageScene = cc.Scene.extend({
	onEnter:function () {
		this._super();
		var layer = new StartPageLayer();
		this.addChild(layer);
	}
});

